#!/usr/bin/python2

import pygame

from utils import Constants


class Speed(pygame.sprite.Sprite):

    def __init__(self, x, y, pattern, speed, groups=tuple()):
        # Initialize parent
        pygame.sprite.Sprite.__init__(self, groups)
        # Set the image and bounds
        self.image = pygame.surface.Surface((Constants.GRID_SIZE, ) * 2,
                                            pygame.SRCALPHA)
        color = pygame.color.Color(Constants.DOOR_COLOR)
        for r in xrange(min(len(pattern), Constants.GRID_SIZE)):
            for c in xrange(min(len(pattern[r]), Constants.GRID_SIZE)):
                if pattern[r][c].strip():
                    pygame.draw.rect(self.image, color, (c, r, 2, 2))
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y
        self.__spd = speed

    def multiplier(self):
        return self.__spd

    def update(self, delta, rotation, groups):
        pass
